<?php

use App\Http\Controllers\UserController;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$app->get('/', function () use ($app) {
    return $app->version();
});

//版本号V1
$app->group(['prefix' => 'api/v1'], function($app){
	
	//User 用户相关操作
	$app->group(['prefix' => 'user'], function($app){
		$app->post('register','UserController@createUser'); 		//注册
		$app->post('login','UserController@login'); 				//登录
		$app->post('logout','UserController@logout');				//注销
		$app->post('modify','UserController@modify');				//修改信息
		$app->post('modify/password','UserController@modifyPassword');
// 		$app->delete('user/{id}','UserController@deleteUser');
		$app->get('info/{token}','UserController@info');
		$app->get('vip/{token}','UserController@vip');
		$app->post('test','UserController@test');
//		$app->post('heartBeat','UserController@heartBeat'); //心跳包

		$app->post('heartBeat','UserController@updateHeartBeatData'); //心跳包

		$app->get('clearheartbeat','UserController@clearHeartBeat'); //清除心跳
	});

	//服务器
	$app->group(['prefix' => 'line'], function($app){
		$app->post('list','LineController@get');
		$app->post('account','AccountController@get');
		$app->post('create','LineController@create');
	});
	
	//版本检查
	$app->get('version/check/{no}','VersionController@check');
	

	
});




$app->group(['namespace'=>'Radius'],function() use ($app){

	$app->post('/radius/V1/login','UserController@login');                           		//    用户登录
	$app->get('/radius/V1/logout','UserController@logout');                         		//    用户退出

	$app->post('/radius/V1/accountlist','UserController@getAccountList');                  	//   获取用户列表

	$app->post('radius/V1/createuser','UserController@createUser');                  		//   创建用户

	$app->post('/radius/V1/addacouunt','UserController@addAcouunt');                		//   添加账号
	$app->post('/radius/V1/updateaccount','UserController@updateAcouunt');          		//   修改账号信息
	$app->get('/radius/V1/getaccountonlineinfo','UserController@getAccountOnlineInfo');     //   获取账号在线信息
	$app->get('/radius/V1/forbiddenaccount','UserController@forbiddenAccount');          	//   账号禁用
	$app->post('/radius/V1/getaccountbilllist','UserController@getBillList');          		//   用户账单列表
	$app->get('/radius/V1/getonlinelist','UserController@getOnlineList');          			//   用户账单列表

	$app->post('/radius/V1/deleteaccount','UserController@deleteAccountLine');          		//   用户账单列表
	$app->get('/radius/V1/getuserinfo','UserController@getUserInfo');          				//   用户账单列表
	$app->get('/radius/V1/checkusername','UserController@checkUserName');          		    //   检测用户名
	$app->post('/radius/V1/renewaccount','UserController@renewaccount');          		    //   账户续费
	$app->post('/radius/V1/renewaccount','UserController@renewaccount');          		    //   账户续费
	$app->get('/radius/V1/limitspeed','UserController@limitSpeed');          		    	//   账户续费
	$app->get('/radius/V1/getip','TestController@getIp');          		    			//   批量续费


	$app->get('/radius/V1/updateline','CrontabController@updateLinelist');							//   更新线路列表
	$app->get('/radius/V1/updateuserbalance','CrontabController@updateUserBalance');				//   更新用户约

	$app->get('/radius/V1/deleteexpiredaccount','CrontabController@deleteExpiredAccount');			//   删除过期用户数据
	$app->get('/radius/V1/update','UserController@updateData');          		    				//   平台数据更新
	$app->post('/radius/V1/batchrenew','BatchController@batchRenew');          		    			//   批量续费

	$app->post('/radius/V1/batchadd','BatchController@batchAdd');          		    								//   批量续费

	$app->post('/radius/V1/manageuserlist','TestController@ManageUserList');          		    					//   批量续费

	$app->get('/radius/V1/getOnlineTeam','OnlineTeamController@getOnlineTeam');          		    					//   在线客服列表
	$app->get('/radius/V1/getOnlineTeamUpdate','OnlineTeamController@getOnlineTeamUpdate');          		    		//   在线客服列表
	$app->post('/radius/V1/onlineupdateAaccount','OnlineTeamController@onlineTeamUpdateUserInfo');          		    //   在线客服账号信息修改
	$app->post('/radius/V1/onlinedeleteAaccount','OnlineTeamController@onlineTeamDeleteUserInfo');          		    //   在线客服账号信息删除
	$app->post('/radius/V1/onlineaddAaccount','OnlineTeamController@onlineTeamAdd');          		    				//   在线客服账号信息添加
	$app->get('/radius/V1/onlineteamdatalist','OnlineTeamController@getOnlineTeamDataList');          		    		//   在线客服账号数据列表
	$app->get('/radius/V1/onlineteamuserinfo','OnlineTeamController@getOnlineTeamUserInfoDataList');          		    //   在线客服账号数据列表
	$app->get('/radius/V1/submitAudit','OnlineTeamController@doSubmitAudit');          		    						//   管理员提交审核
	$app->post('/radius/V1/addaudit','OnlineTeamController@doAddAudit');
	$app->post('/radius/V1/auditdelete','OnlineTeamController@doAuditDelete');



	$app->post('/radius/V1/getmanageinfo','UserController@getManageInfo');											//  管理员优惠列表

	$app->post('/radius/V1/getadminlist','AdminController@getAdminList');
	$app->post('/radius/V1/adminupdate','AdminController@doAdminUpdate');
	$app->post('/radius/V1/admin/recharge','AdminController@doAdminRecharge');
	$app->post('/radius/V1/admin/delete','AdminController@doAdminDelete');
	$app->post('/radius/V1/admin/add','AdminController@doAdminAdd');

	$app->get('/radius/V1/updatespeed','TestController@updateSpeed');





});


	//版本号V1
	$app->group(['prefix' => 'v1'], function($app){
	
		//User 用户相关操作
		$app->group(['prefix' => 'user'], function($app){
			$app->post('register','UserController@createUser'); 		//注册
			$app->post('login','UserController@login'); 				//登录
			$app->post('logout','UserController@logout');				//注销
			$app->post('modify','UserController@modify');					//修改信息
			$app->post('modify/password','UserController@modifyPassword');
			// 		$app->delete('user/{id}','UserController@deleteUser');

			$app->get('info/{token}','UserController@info');

			$app->get('web_user_info','UserController@getWebUserInfo');
			$app->get('get_code','VerifyCodeController@get');			//  获取验证码

			$app->get('vip/{token}','UserController@vip');
			$app->post('test','UserController@test');
//			$app->post('heartBeat','UserController@heartBeat'); //心跳包

			$app->post('heartBeat','UserController@updateHeartBeatData'); //心跳包

			$app->get('clearheartbeat','UserController@clearHeartBeat'); //清除心跳

			$app->get('kefuqq','UserController@KeFuqq'); //清除心跳
			$app->get('getTeamqq','UserController@getTeamqq'); //清除心跳

		   $app->post('weblogin','UserWebController@login'); 				//登录
		   $app->post('weblogout','UserWebController@logout'); 				//注销

		   $app->get('bind/phone','UserWebController@bindPhone'); 				//绑定手机号
		   $app->get('bind/qq','UserWebController@updateQQ'); 					//绑定qq号
		   $app->get('update/email','UserWebController@updateEmail'); 				//绑定邮箱
		   $app->get('updatePassword','UserWebController@updatePassword'); 				//修改密码

			$app->get('accountGetUserId','UserWebController@accountGetUserId'); 		//  用户名获取用户ID
			$app->get('discountCoupon','UserWebController@discountCoupon'); 			//  优惠券优惠


			$app->get('order/list','OrderController@getOrderList'); 				//获取订单列表
		   $app->get('createorder','OrderController@createAliPayOrder'); 				//获取订单列表
		   $app->get('product','ProductController@getProductList'); 				//获取产品列表
		   $app->get('product/info','ProductController@getProductInfo'); 				//获取产品详情
		   $app->get('pay','PayController@SlingAliPay'); 					   //调起阿里支付
		   $app->post('paycallback','AliPay\AliPayNotifyController@PayCallback'); 					   //服务器异步通知页面





		});





		//代理
		$app->group(['prefix' => 'agent'], function($app){
			$app->post('login','AgentController@agentLogin');				//   代理登录
			$app->post('addUser','AgentController@addAgentUser');				//   代理登录
			$app->get('getConsumptionRecord','AgentController@getConsumptionRecord');				//   开户记录列表
			$app->get('getAccountNumber','AgentController@getAccountNumber');				//   获取账户列表
			$app->get('agentinfo','AgentController@userInfo');				//   获取账户列表
			$app->get('productList','AgentController@productList'); 				//获取产品列表
			$app->get('getUserInfo','AgentController@getUserInfo'); 				//获取产品列表
			$app->post('renewVip','AgentController@renewVip'); 				//续费
		});








		//服务器
		$app->group(['prefix' => 'line'], function($app){
			$app->post('list','LineController@get');
			$app->post('account','AccountController@get');
			$app->post('create','LineController@create');
		});

		//版本检查
		$app->get('version/check/{no}','VersionController@check');
		
		//检测清理
		$app->get('monitor/show/{key}','MonitorController@index');
		$app->get('monitor/recovery/{key}','MonitorController@recovery');
	
	});

